package common;

public enum DataTypeEnum {
	INTEGER(int.class.getSimpleName()),
	LONG(long.class.getSimpleName()),
	FLOAT(float.class.getSimpleName()),
	CHAR(char.class.getSimpleName()),
	BOOLEAN(boolean.class.getSimpleName()),
	BYTE(byte.class.getSimpleName()),
	CURRENCY_ENUM(CurrencyEnum.class.getSimpleName()),
	STRING(String.class.getSimpleName()), 
	MESSAGE_TYPE_ENUM(common.data.MessageTypeEnum.class.getSimpleName()),
	REQUEST_TYPE_ENUM(common.data.RequestTypeEnum.class.getSimpleName());
	
	private String name;
	
	DataTypeEnum(String name){
		this.setName(name);
	}
	
	public static DataTypeEnum getDataTypeEnumByName(String name){
		for (DataTypeEnum typeEnum:DataTypeEnum.values()){
			if (typeEnum.getName().equalsIgnoreCase(name)){
				return typeEnum;
			}
		}
		System.out.println("Cannot found enum for name" + name);
		return null;
	}
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
}
